local skill = fk.CreateSkill{
  name = "tea__lianhe_viewas",
}
local U = require "packages/utility/utility"
---@class ViewAsSkill
---@field is_self boolean
---@field expand_pile integer[] CardIds
---@type ViewAsSkillSpec
local lianhe_viewas = {
  mute = true,
  card_filter = function (self, player, to_select, selected)
    if #selected == 0 then
      if self.is_self then
        return table.contains(player:getCardIds("h") or {}, to_select)
      else
        return table.contains(self.expand_pile or {}, to_select)
      end
    end
  end,
  view_as = function(self, player, cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("duel")
    card.skillName = skill.name
    card:addSubcard(cards[1])
    return card
  end,
}
skill:addEffect("viewas", lianhe_viewas)
return skill